home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0195.ZIP / GETFREE.PAS < prev    next >
Pascal/Delphi Source File  |  1984-12-18  |  1KB  |  32 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. }
  6. {$I regpack.typ}
  7. {$I getfree.lib}
  8. {$I getsetdd.lib}
  9. var
  10.   OK : boolean;
  11.   drv : char;
  12.   HowMuch : real;
  13. begin
  14.   repeat
  15.     Write('Enter drive to check -- just <enter> for current :');
  16.     read(drv);
  17.     WriteLn;
  18.   until UpCase(drv) in [#26,'A'..'D'];  { for some reason, if you just <enter>
  19.                                           in response to a READ of a CHAR,
  20.                                           character #26 is received }
  21.   if drv = #26 then drv := '@'    { GetFree uses "@" to represent the current
  22.                                     drive because it comes just before "A" in
  23.                                     the ASCII order.  }
  24.     else drv := UpCase(drv);
  25.   GetFree(drv,HowMuch,OK);
  26.   if OK then
  27.     begin
  28.       if drv = '@' then GetSetDrive('G',drv);
  29.       Write(HowMuch:1:0,' bytes free on drive ',drv);
  30.     end
  31.   else WriteLn('Invalid drive');
  32. end.